<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    fullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <template slot="footer">
      <a-button @click="handleCancel">关闭</a-button>
      <a-button @click="handleTest" type="primary">测试</a-button>
    </template>

    <msi-task-exo-server-test-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></msi-task-exo-server-test-form>
  </j-modal>
</template>

<script>
  import MsiTaskExoServerTestForm from './MsiTaskExoServerTestForm'
  export default {
    name: 'MsiTaskExoServerTestModal',
    components: {
      MsiTaskExoServerTestForm
    },
    data () {
      return {
        title:'',
        width:1200,
        visible: false,
        disableSubmit: false
      }
    },
    methods: {
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      },
      handleTest(){
        this.$refs.realForm.test();
      }
    }
  }
</script>
